package cn.iocoder.yudao.module.lesson.dal.mysql.lesson;

import java.util.*;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.module.lesson.dal.dataobject.lesson.LessonDO;
import org.apache.ibatis.annotations.Mapper;
import cn.iocoder.yudao.module.lesson.controller.admin.lesson.vo.*;

/**
 * 课程管理（针灸，内经，神龙本草，伤寒，金匮） Mapper
 *
 * @author 芋道源码
 */
@Mapper
public interface LessonMapper extends BaseMapperX<LessonDO> {

    default PageResult<LessonDO> selectPage(LessonPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<LessonDO>()
                .eqIfPresent(LessonDO::getLessonCode, reqVO.getLessonCode())
                .likeIfPresent(LessonDO::getLessonName, reqVO.getLessonName())
                .likeIfPresent(LessonDO::getLessonDesc, reqVO.getLessonDesc())
                .betweenIfPresent(LessonDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(LessonDO::getId));
    }

    default List<LessonDO> selectList(LessonExportReqVO reqVO) {
        return selectList(new LambdaQueryWrapperX<LessonDO>()
                .eqIfPresent(LessonDO::getLessonCode, reqVO.getLessonCode())
                .likeIfPresent(LessonDO::getLessonName, reqVO.getLessonName())
                .likeIfPresent(LessonDO::getLessonDesc, reqVO.getLessonDesc())
                .betweenIfPresent(LessonDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(LessonDO::getId));
    }

}
